<template>
  <!-- 已收/合同总额 -->
  <div class="radio-select">
    <div class="radio-list">
      <el-radio-group v-model="filterListData[0].value[0]">
        <el-radio :value="item.value" v-for="item in filterListData[0].option.data">
          <span>{{ item.label }}</span>
        </el-radio>
      </el-radio-group>
    </div>
    <div class="radio-select__buttons">
      <el-button type="primary" class="buttons-cancel" link size="default" @click="handelReset">重置</el-button>
      <el-button type="primary" class="buttons-confirm" size="default" @click="handelConfirm">确定</el-button>
    </div>
  </div>
</template>

<script setup>
import { ref, watch } from "vue";

const props = defineProps({
  filterList: [
    {
      title: "是否收款完成",
      filterId: "receive_complete",
      condition: [
        {
          label: "等于",
          value: "eq"
        }
      ],
      option: {
        type: "InputSelect",
        lazy: false,
        dataSource: {},
        data: [
          {
            label: "全部",
            value: null
          },
          {
            label: "已收齐",
            value: true
          },
          {
            label: "未收齐",
            value: false
          }
        ]
      },
      compare: "eq",
      value: []
    }
  ]
});
const emit = defineEmits(["handelFilterData"]);
const filterListData = ref([]);

watch(
  () => props.filterList,
  newVal => {
    filterListData.value = [...newVal];
  },
  { deep: true, immediate: true }
);

const handelReset = () => {
  filterListData.value[0].value = [""];
  emit("handelFilterData", filterListData.value);
};
const handelConfirm = () => {
  emit("handelFilterData", filterListData.value);
};
</script>

<style scoped lang="scss">
@import "radioSelect";
</style>
